{{ define "main" }}
<div class="container">
    <div class="text-center mb-5">
        <h1 class="display-4 fw-bold">{{ .Site.Title }}</h1>
        <p class="lead text-muted">{{ .Site.Params.description }}</p>
    </div>
    
    <div class="articles-grid">
        {{ range first 6 (where .Site.RegularPages "Type" "posts") }}
        <article class="article-card">
            <header class="article-header">
                <h2 class="article-title">
                    <a href="{{ .Permalink }}" class="text-decoration-none">{{ .Title }}</a>
                </h2>
                <div class="article-meta">
                    <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006年1月2日" }}</time>
                    {{ if .Params.author }}
                    <span class="article-author">作者：{{ .Params.author }}</span>
                    {{ end }}
                    {{ if .Params.tags }}
                    <div class="article-tags">
                        {{ range first 3 .Params.tags }}
                        <span class="tag">{{ . }}</span>
                        {{ end }}
                    </div>
                    {{ end }}
                </div>
            </header>
            <div class="article-content">
                <p>{{ .Summary | truncate 150 }}</p>
                <a href="{{ .Permalink }}" class="pwa-button">阅读全文</a>
            </div>
        </article>
        {{ end }}
    </div>
    
    {{ if gt (len (where .Site.RegularPages "Type" "posts")) 6 }}
    <div class="text-center mt-5">
        <a href="/posts/" class="pwa-button">查看更多文章</a>
    </div>
    {{ end }}
</div>
{{ end }}